package com.pan.action.chain;

import com.pan.action.MyAction;

public abstract class ChainAction<T> implements MyAction<T> {


    public ChainAction() {
    }

    private ChainAction nextAction = null;
    public ChainAction setNext(ChainAction chainAction){
        this.nextAction = chainAction;
        return nextAction;
    }
    @Override
    public void hook(T keys) {
        this.handle(keys);
        if (nextAction!=null){
            nextAction.hook(keys);
        }
    }

    public abstract void handle(T keys);

}

